import { IToolTipItem } from "../../../../../com/mui/manager/IToolTipItem";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { SkillItem } from "../SkillItem";
import { ResouceConst } from "../../../../component/gconst/ResouceConst";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { SkillInfo } from "../../../model/SkillInfo";
import { ToolTipsManager } from "../../../../../com/mui/manager/ToolTipsManager";
import { ScaleBitmap } from "../../../../../com/mui/display/ScaleBitmap";
//class SkillBaseRender
    
    export  class SkillBaseRender /* flash.display.Sprite */ implements IToolTipItem
    {
        constructor()
        {
            
            this._border = GlobalClass.getBitmap(ImagesConst.PackItemBg);
            addChild(this._border);
            this._skillItem = new SkillItem();
            this._skillItem.x = 3;
            this._skillItem.y = 3;
            addChild(this._skillItem);
            this._bg = ResouceConst.getScaleBitmap(ImagesConst.WindowCenterB);
            this._bg.width = 150;
            this._bg.height = 20;
            this._bg.x = 60;
            this._bg.y = (this._border.height - this._bg.height) / 2;
            addChild(this._bg);
            this._infoTxt = new Object /* flash.text.TextField */();
            this._infoTxt.defaultTextFormat = new GTextFormat(FontUtil.songtiName, 14, 65280, true);
            this._infoTxt.autoSize = flash.text.TextFieldAutoSize.CENTER;
            this._infoTxt.width = 150;
            this._infoTxt.height = 20;
            this._infoTxt.selectable = false;
            this._infoTxt.x = 130;
            this._infoTxt.y = this._bg.y + 1;
            addChild(this._infoTxt);
            return;
        }

        public udpateData(arg1: SkillInfo): void
        {
            this._skillInfo = arg1;
            this._skillItem.data = arg1;
            this._infoTxt.text = arg1.tSkill.skillName;
            this.toolTipData = arg1.getShortToolTips();
            return;
        }

        public get skill(): SkillInfo
        {
            return this._skillInfo;
        }

        public dispose(): void
        {
            this.toolTipData = null;
            return;
        }

        public /* override */ get height(): number
        {
            return this._skillItem.height;
        }

        public get toolTipData()
        {
            return this._tooltipData;
        }

        public set toolTipData(arg1)
        {
            if (arg1 == null || arg1 == "") 
            {
                ToolTipsManager.unregister(this);
            }
            else 
            {
                ToolTipsManager.register(this);
            }
            this._tooltipData = arg1;
            return;
        }

        /* internal */ /* var */_skillInfo: SkillInfo;

        /* internal */ /* var */_skillItem: SkillItem;

        /* internal */ /* var */_infoTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_bg: ScaleBitmap;

        /* internal */ /* var */_border: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_tooltipData;
    }
